package com.neusoft.socket;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class Client {
	private Socket s = null;
	private BufferedReader bf = null;
	private PrintWriter pw =null;
	public Client(){
		try {
			s = new Socket("127.0.0.1",8888);
			System.out.println("The Server Connected!");
			System.out.println("Please enter some Character:");
			BufferedReader line = new BufferedReader(new InputStreamReader(System.in));
			pw = new PrintWriter(s.getOutputStream(),true);
			pw.println(line.readLine());
			bf = new BufferedReader(new InputStreamReader(s.getInputStream()));
			System.out.println(bf.readLine());
			pw.close();
			bf.close();
			s.close();
		} catch (Exception e) {
			pw.println("wrong");
		}
		
	}
	public static void main(String[] args) {
		new Client();
		new Client();
	}
}
